﻿'This interface allow the MapWindow plugin to launch WRDB remotely

<CLSCompliant(True)> _
Public Interface clsWRDB
    Sub ShowMainFormMW()
    Function GetMainFormMW() As System.Windows.Forms.Form
    Sub CloseMainFormMW()
    WriteOnly Property MapWin() As Object 'coerce to MapWindow.Interfaces.IMapWin
    Event Closed()
    Sub MapMouseMove(ByVal ScreenX As Integer, ByVal ScreenY As Integer)
    Sub MapExtentsChanged()
    Sub ShapesSelected()
End Interface

Public Class clsAccessWRDB
    Const REGAPP As String = "WRDB"

    Public Shared Function DLLPath() As String
        If False AndAlso Diagnostics.Debugger.IsAttached And Environment.UserName.Contains("LCW") Then
            Return "C:\Projects\WRDB 5.0\bin"
        Else
            Return GetSetting(REGAPP, "Defaults", "DLL Path", "C:\Program Files\Water Resources Database 5.0")
        End If
    End Function

    Public Shared Function WRDBIsInstalled(Optional ByRef ErrorMsg As String = "") As Boolean
        If IO.Directory.Exists(DLLPath) AndAlso IO.File.Exists(DLLPath() & "\WRDB.exe") Then
            ErrorMsg = ""
            Return True
        Else
            ErrorMsg = String.Format("Unable to find the necessary WRDB libraries. You must download and install WRDB 5.0 for this program to run properly (it is available at www.wrdb.com). If you have installed the latest version of WRDB 5.0 into a non-default drive or directory, you must run the stand-alone version of WRDB at least once so it can register its location and thus allow this application to find it.")
            Return False
        End If
    End Function

    Public Shared Function LaunchWRDB() As Boolean
        If WRDBIsInstalled() Then
            Shell(DLLPath() & "\WRDB.exe", AppWinStyle.NormalFocus)
            Return True
        Else
            Return False
        End If
    End Function

    Public Shared Function LaunchWRDBGraph() As Boolean
        If WRDBIsInstalled() Then
            Shell(DLLPath() & "\WRDBGraph.exe", AppWinStyle.NormalFocus)
            Return True
        Else
            Return False
        End If
    End Function

End Class

'Public Interface clsGraph
'    Sub ShowGraph(Optional ByVal OwnerForm As Form = Nothing, Optional ByVal GraphFile As String = "", Optional ByVal LoadLast As Boolean = False)
'End Interface

'Public Interface clsProject
'    Enum enumTableTypes As Integer
'        Temporary
'        Working  'may have many working tables
'        Master   'single master table
'        Stations 'following are support tables
'        PCodes
'        CCodes
'        RCodes
'        QCodes
'        Branches
'        StaGrp
'        PCodeGrp
'        Tracking
'    End Enum

'    Enum enumDBType
'        Paradox
'        Access
'        SQL_Server
'        Oracle
'        Firebird
'        Firebird_Embedded
'        MySQL
'        SQLite
'        DBase
'        Excel
'        Text
'        CSV
'    End Enum

'    Sub Initialize(ByVal ProjectName As String, Optional ByVal IsTempProject As Boolean = False)

'    Function FullTableName(ByVal TableName As String) As String

'    Function GetTableList(ByVal ParamArray TableType() As enumTableTypes) As Generic.List(Of String)

'    Function GetColumnList(ByVal TableName As String) As Generic.List(Of String)

'    Function GetFieldList(ByVal TableName As String, ByVal ColumnName As String, Optional ByVal WhereClause As String = "") As Generic.List(Of String)

'    Function ExecuteReader(ByVal SqlString As String, ByVal ParamArray Args() As String) As DbDataReader

'    Function AddTable(ByRef DataSet As Data.DataSet, ByVal TableName As String, ByVal SqlString As String) As DbDataAdapter

'    Function CopyPDoxSupportTables(ByVal DataTabletype As enumTableTypes, ByVal ParamArray TableTypes() As enumTableTypes) As Boolean

'    Function DateTime(ByVal DateTimeValue As DateTime) As String

'    Function ResetPDox(Optional ByVal TableName As String = "") As Boolean

'    'Function CreateTempProject(Optional ByVal ProviderType As enumDBType = enumDBType.Paradox, Optional ByVal DataSource As String = "", Optional ByVal _WorkingDir As String = "", Optional ByVal _MasterDir As String = "", Optional ByVal _SupportDir As String = "", Optional ByVal _SupportDirProj As String = "") As Boolean

'End Interface

'Public Interface clsWRDBIniFile

'    Enum enumSection
'        Application
'        Project
'    End Enum

'    ''' <summary>
'    ''' Standard application and project keys which are mapped to the actual key names; this allows use of Intellisense to ensure that the correct key names are used
'    ''' </summary>
'    Enum enumKey
'        'begin keys global to the application (for this user)
'        AppLastProjectName
'        AppLastQueryProject
'        AppLastQueryTable
'        AppLastQueryTime
'        AppLastQuerySQL
'        AppLastQueryRecords
'        AppLastEditTime
'        AppExpertMode
'        AppShowStartup
'        AppShowGettingStarted
'        AppCheckUpdates
'        AppUpdateLocation
'        AppProxyAddress
'        AppProxyUsername
'        AppProxyPassword
'        AppRptHeading1
'        AppRptHeading2
'        AppRptScaling
'        AppPromptImport
'        AppUserName
'        AppPrintMarginsLeft
'        AppPrintMarginsRight
'        AppPrintMarginsTop
'        AppPrintMarginsBottom
'        AppGridFontName
'        AppGridFontSize

'        'begin keys for each project
'        Description
'        Password
'        TitleBarText
'        DesktopGraphic
'        DesktopColorTheme
'        MasterTable
'        Path_Master
'        Path_Support
'        Path_SupportProj
'        Path_Working
'        Path_Archive
'        Path_BulkInsert
'        Path_SQL
'        DatabaseType
'        DataSource
'        DatabaseName
'        DbUserName
'        DbPassword
'        ExportPath
'        ExportFormat
'        Rpt_OutputTo
'        Rpt_Comments
'        Rpt_DateTimeRCode
'        ShowTablesOnly
'        Timeout
'        DisplayRecordCount
'        QueryOption
'        GisQuickList
'        GisQuickTable
'        GisDirectory

'        NumGIS
'        GIS_XMin
'        GIS_XMax
'        GIS_YMin
'        GIS_YMax
'        GIS_Display
'        GIS_PCode
'        GIS_Aggregate
'        GIS_DateTime
'        GIS_AnimSpeed
'        GIS_DataFile
'        GIS_DataFileRelative
'        GIS_DataLayer
'        GIS_DataField
'        GIS_DataColor0
'        GIS_DataColor1
'        GIS_DataColor2
'        GIS_DataColor3
'        GIS_DataColor4
'        GIS_DataInvert
'        GIS_DataThresholdType
'        GIS_DataThresholdValue

'        GISName
'        GISShapeFile
'        GISShapeFileRelative
'        GISLineColor
'        GISLineWidth
'        GISLineStipple
'        GISFilled
'        GISFillColor
'        GISFillStipple
'        GISFillTransparency
'        GISVisible
'        GISPointColor
'        GISPointSize
'        GISPointType
'    End Enum

'    Function GetProjectNames() As ArrayList
'    Function GetKey(ByVal ProjectName As String, ByVal KeyType As enumKey, Optional ByVal DefaultKeyText As String = "") As String
'    Function GetKeyApp(ByVal KeyType As enumKey, Optional ByVal DefaultKeyText As String = "") As String
'End Interface

'Public Interface DGVEditor

'    Enum enumReportScaling
'        None
'        Stretched
'        Multiline
'        ScaledFonts
'    End Enum

'    Enum ColumnTypes
'        None
'        ComboBox
'        ComboBoxEdit
'        CheckBox
'        Calendar
'        Link
'        ColorPicker
'    End Enum

'    Enum enumUndoAction
'        ChangeCell
'        InsertRow
'        InsertColumn
'        DeleteRow
'        DeleteColumn
'    End Enum

'    Sub Initialize(ByRef _dgv As DataGridView, Optional ByRef _GridFont As Drawing.Font = Nothing, Optional ByRef _ReportScaling As enumReportScaling = enumReportScaling.None, Optional ByRef _printDoc As Drawing.Printing.PrintDocument = Nothing)
'    ReadOnly Property DataGridView() As DataGridView
'    Sub SetHeadings(ByVal DelimitedColumnHeadings As String, Optional ByVal AutoNumberRows As Boolean = True, Optional ByVal RowCount As Integer = 50, Optional ByVal VirtualMode As Boolean = False)
'    Sub AddRowItems(ByVal ParamArray Items() As Object)
'    Sub AutoResizeColumnsEqual(ByVal columnIndex1 As Integer, ByVal columnIndex2 As Integer, Optional ByVal autoSizeColumnMode As DataGridViewAutoSizeColumnMode = DataGridViewAutoSizeColumnMode.AllCells)
'    Sub RenumberRows()
'    Sub SetCellFormatList(ByVal col As Integer, ByVal row As Integer, ByVal ComboItems As String, Optional ByVal ExtraItem As String = "", Optional ByVal AllowEditing As Boolean = False)
'    Sub SetColumnFormat(ByVal ColumnType As ColumnTypes, ByVal col As Integer, Optional ByVal ComboItems As Generic.List(Of String) = Nothing)
'    Sub SetColumnWidth(ByVal Col As Integer, ByVal Text As String)
'    Property AutoFillSelectedCells() As Boolean
'    Property AutoNumberRows() As Boolean
'    Property AllowRowChange() As Boolean
'    Property IsModified() As Boolean
'    Property ReadOnlyColumn(ByVal Col As Integer) As Boolean
'    Property ReadOnlyRow(ByVal Row As Integer) As Boolean
'    Sub AddUndo(ByVal Column As Integer, ByVal Row As Integer, Optional ByVal UndoID As Integer = 0)
'    Sub AddUndo(ByVal _Column As Integer, ByVal _Row As Integer, ByVal _Action As enumUndoAction, Optional ByVal _UndoID As Integer = 0)
'    Sub Undo(Optional ByVal NumToUndo As Integer = 1)
'    Event BeforeContextMenu(ByVal sender As Object, ByVal e As ContextMenuEventArgs)
'    Event AfterContextMenu(ByVal sender As Object, ByVal e As ContextMenuEventArgs)
'    Event HasBeenModified(ByVal sender As Object, ByVal e As System.EventArgs)
'End Interface

''this is deprecated in favor of clsReport which is more powerful

'Public Interface DGVPrinter
'    Sub Initialize(ByRef _dgv As DataGridView, ByRef _PrintDoc As System.Drawing.Printing.PrintDocument)
'    ReadOnly Property DataGridView() As DataGridView
'    Property Title() As String
'    Property TitleFont() As System.Drawing.Font
'    Property TitleAlignment() As System.Drawing.StringAlignment
'    Property SubTitle() As String
'    Property SubTitleFont() As System.Drawing.Font
'    Property SubTitleAlignment() As System.Drawing.StringAlignment
'    Property SubTitle2() As String
'    Property SubTitle2Font() As System.Drawing.Font
'    Property SubTitle2Alignment() As System.Drawing.StringAlignment
'    Property RepeatTitles() As Boolean
'    Property Footer() As String
'    Property FooterFont() As System.Drawing.Font
'    Property FooterAlignment() As System.Drawing.StringAlignment
'    Property PageNumberInHeader() As Boolean
'    Property ProportionalColumns() As Boolean
'    Property AllowWordWrap() As Boolean
'    Property AutoReduceFont() As Boolean
'    Property IsOverflowCell(ByVal columnIndex As Integer, ByVal rowIndex As Integer) As Boolean
'    Sub PrintDataGridView(Optional ByVal Preview As Boolean = False)
'End Interface

'Public Interface clsReport
'    Enum enumRepeatAllPages
'        None
'        Header
'        Footer
'    End Enum
'    Sub Initialize(ByRef _PrintDoc As Drawing.Printing.PrintDocument)
'    Sub AddTextbox(ByVal Text As String, ByVal FontSize As Single)
'    Sub AddTextbox(ByVal Text As String, ByVal Font As Drawing.Font, ByVal ForeColor As Drawing.Color, ByVal Alignment As HorizontalAlignment, ByVal Repeat As enumRepeatAllPages)
'    Sub AddDataGridView(ByRef Dgv As DataGridView, ByVal ProportionalColumns As Boolean, ByVal AutoReduceFont As Boolean, ByVal AllowWordWrap As Boolean, Optional ByVal ColumnWidthOverrides() As Single = Nothing)
'    Sub AddSpace(ByVal VerticalSpace As Single)
'    Sub PrintReport(Optional ByVal Preview As Boolean = False)
'    Sub PrintReportToPDF(Optional ByVal Preview As Boolean = False)
'End Interface

'Public Class ContextMenuEventArgs
'    Public Enum ContextMenuTypeEnum
'        Fill
'        Cut
'        Copy
'        Paste
'        Delete
'        DuplicateRow
'        SelectAll
'        Undo
'        Find
'        Replace
'        Add
'        Multiply
'        Series
'        AppendRows
'        InsertRows
'        DeleteRows
'        ClearTable
'        Print
'        Stats
'        PDF
'        Excel
'        Graph
'    End Enum
'    Public Sub New(ByVal _ContextMenuType As ContextMenuTypeEnum)
'        ContextMenuType = _ContextMenuType
'    End Sub
'    Public Sub New()
'    End Sub
'    Public ContextMenuType As ContextMenuTypeEnum 'what menu was selected?
'    Public Cancel As Boolean   'should the command be cancelled?
'    Public RowIndex As Integer 'the first row affected by the command
'    Public RowCount As Integer 'the number of rows affected (if applicable)
'End Class

'Public Class ProgressEventArgs
'    Public Sub New(ByVal _Percent As Integer, ByVal _CanCancel As Boolean)
'        Percent = _Percent
'        CanCancel = _CanCancel
'    End Sub
'    Public Sub New()
'    End Sub
'    Public Percent As Integer  'percent complete
'    Public CanCancel As Boolean 'allow user to cancel command?
'    Public Cancel As Boolean   'has the command been cancelled?
'End Class

''Public Interface clsDataSource
''    Sub Initialize(ByVal _Filename As String)
''    ReadOnly Property FieldNames() As Generic.List(Of String)
''    Function TableName() As Generic.List(Of String)
''    ReadOnly Property Items(ByVal Index As Integer) As String
''    ReadOnly Property Items(ByVal FieldName As String) As String
''    Property ActiveTable() As String
''    Property ActiveStationID() As String
''    Function PercentComplete() As Double
''    Function Read() As Boolean
''    Sub Rewind(ByVal _HasHeaders As Boolean)
''    Sub Dispose()
''End Interface

'Public Interface clsBMD
'    Sub Initialize(ByVal Filename As String, ByVal CreateFile As Boolean, Optional ByVal SeedYear As Integer = 1970, Optional ByVal InRam As Boolean = True, Optional ByVal NumTimes As Integer = 0, Optional ByVal NumSegments As Integer = 0, Optional ByVal NumVars As Integer = 0)
'    Property NumSegments() As Integer
'    Property NumVars() As Integer
'    Property NumTimes() As Integer
'    Function VarIndex(ByVal VarName As String) As Integer
'    Property SegmentName(ByVal SegIndex As Integer) As String
'    Property VarName(ByVal VarIndex As Integer) As String
'    Property VarUnits(ByVal VarIndex As Integer) As String
'    Property Time(ByVal TimeIndex As Integer) As Date
'    ReadOnly Property Conc(ByVal SegName As String, ByVal VarName As String) As Single()
'    ReadOnly Property Conc(ByVal VarName As String, ByVal DateTime As Date) As Single()
'    Property Conc(ByVal VarName As String, ByVal SegName As String, ByVal TimeIndex As Integer) As Single
'    Property Conc(ByVal TimeIndex As Integer) As Single(,) Implements Interfaces.clsBMD.Conc
'    Property Conc(ByVal VarIndex As Integer, ByVal SegIndex As Integer, ByVal TimeIndex As Integer) As Single
'    Sub Close()
'End Interface

''Public Interface clsData
''    Sub Initialize(ByVal FileName As String)
''    Property ActiveStationID() As String
''    Function Read() As Boolean
''    ReadOnly Property Items(ByVal Index As Integer) As String
''    ReadOnly Property Items(ByVal FieldName As String) As String
''    ReadOnly Property FieldNames() As Generic.List(Of String)
''End Interface

''Public Interface clsTable
''    Enum enumTableType
''        WRDB5
''        WRDB4
''        Database 'for MDB, XLS, SDB, FDB
''        Folder   'for TXT, CSV, DB, DBF
''        BMD
''        WRDBData 'for any WRDBData source
''    End Enum

''    Sub Initialize(ByVal GroupFileName As String, ByVal ExpertMode As Boolean)
''    Function CreateBMDProject(ByVal BMDFile As String, Optional ByVal RelativePath As String = "") As Boolean
''    Function CreateDatabaseProject(ByRef DataSource As String, ByRef TableFileName As String, Optional ByVal RelativePath As String = "") As Boolean
''    Function CreateWRDB4Project(ByVal WRDB4ProjectName As String) As Boolean
''    Function CreateWRDB5Project(ByVal WRDB5ProjectName As String) As Boolean
''    Function CreateWRDBDataProject(ByVal DataFile As String, Optional ByVal RelativePath As String = "") As Boolean
''    Property ProjectName() As String
''    Property TableName() As String
''    Property TableFile() As String
''    Property DataSource() As String
''    ReadOnly Property TableType() As enumTableType
''    ReadOnly Property WRDBProject() As clsProject
''    Property dsData As clsWRDBData
''    Function CreateDatabaseProject(p1 As String, p2 As String) As Boolean

''End Interface

'Public Interface clsWRDBData

'End Interface

'Public Interface clsExcel
'    Function ExportZedChart(ByVal Zed As Object, Optional ByVal SheetNamePrefix As String = "") As Boolean
'End Interface

'Public Class clsInstantiate
'    Const REGAPP As String = "WRDB"

'    Public Shared Function DLLPath() As String
'        If False AndAlso Diagnostics.Debugger.IsAttached And Environment.UserName.Contains("LCW") Then
'            Return "C:\Projects\WRDB 5.0\bin"
'        Else
'            Return GetSetting(REGAPP, "Defaults", "DLL Path", "C:\Program Files\Water Resources Database 5.0")
'        End If
'    End Function

'    Public Enum enumLibrary
'        WRDB
'        Project
'        IniFile
'        Report
'        Editor
'        Printer
'        Excel
'        DataSource
'        BMD
'        Table
'        Graph
'    End Enum

'    Public Shared Function LoadLibrary(ByVal Library As enumLibrary) As Object
'        'this routine will try to dynamically load the specified WRDB library which is expected to reside in a particular location
'        '(see DLLPath routine which will try to get WRDB path from registry which is set the first time WRDB is run; if not found will assume is
'        'in program files folder).

'        'If WRDB libraries are found in the current programs directory, then will load from there first.

'        Dim DLLName As String = ""
'        Dim DLLFullName As String = ""
'        Dim LibName As String = ""
'        Select Case Library
'            Case enumLibrary.WRDB : DLLName = "WRDBLib" : LibName = "WRDB.Lib.clsWRDB"
'            Case enumLibrary.Project : DLLName = "WRDBProject" : LibName = "WRDB.Project.clsProject"
'            Case enumLibrary.IniFile : DLLName = "WRDBProject" : LibName = "WRDB.Project.clsWRDBIniFile"
'            Case enumLibrary.Report : DLLName = "WRDBControls" : LibName = "WRDB.Controls.clsReport"
'            Case enumLibrary.Editor : DLLName = "WRDBControls" : LibName = "WRDB.Controls.DGVEditor"
'            Case enumLibrary.Printer : DLLName = "WRDBControls" : LibName = "WRDB.Controls.DGVPrinter"
'            Case enumLibrary.Excel : DLLName = "WRDBExcel" : LibName = "WRDB.MSExcel.clsExcel"
'            Case enumLibrary.DataSource : DLLName = "WRDBData" : LibName = "WRDB.DataSource.clsData"
'            Case enumLibrary.BMD : DLLName = "WRDBData" : LibName = "WRDB.DataSource.clsBMD"
'            Case enumLibrary.Table : DLLName = "WRDBGraphLib" : LibName = "WRDB.Graph.clsTable"
'            Case enumLibrary.Graph : DLLName = "WRDBGraphLib" : LibName = "WRDB.Graph.clsGraph"
'            Case Else : MessageBox.Show("Invalid library specified in LoadLibrary!") : Return False
'        End Select

'        'see if in current program's installation folder...
'        DLLFullName = String.Format("{0}\{1}.dll", IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location), DLLName)

'        If Not IO.File.Exists(DLLFullName) Then            'look in WRDB folder...
'            DLLFullName = String.Format("{0}\{1}.dll", DLLPath, DLLName)
'        End If

'        If DLLFullName <> "" AndAlso IO.File.Exists(DLLFullName) Then
'            Dim objHandle As System.Runtime.Remoting.ObjectHandle = System.Activator.CreateInstanceFrom(DLLFullName, LibName)
'            Return objHandle.Unwrap
'        Else
'            Throw New System.IO.FileNotFoundException(String.Format("Unable to find the following requested WRDB library:\n\n{0}\n\nYou must download and install WRDB 5.0 for this program to run properly (it is available at www.wrdb.com). If you have installed the latest version of WRDB 5.0 into a non-default drive or directory, you must run the stand-alone version of WRDB at least once so it can register its location and thus allow this application to find it.", DLLFullName).Replace("\n", vbCr))
'            Return Nothing
'        End If
'    End Function

'    Public Shared Function GetVersion(Optional ByRef BuildDate As Date = Nothing) As Version
'        Dim DLLName As String = "WRDBLib"

'        'see if in current program's installation folder...
'        Dim DLLFullName As String = String.Format("{0}\{1}.dll", IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location), DLLName)

'        If Not IO.File.Exists(DLLFullName) Then            'look in WRDB folder...
'            DLLFullName = String.Format("{0}\{1}.dll", DLLPath, DLLName)
'        End If

'        If DLLFullName <> "" AndAlso IO.File.Exists(DLLFullName) Then
'            'Dim objHandle As System.Runtime.Remoting.ObjectHandle = System.Activator.CreateInstanceFrom(DLLFullName, LibName)
'            'Return objHandle.Unwrap
'            BuildDate = System.IO.File.GetLastWriteTime(DLLFullName)
'            Return System.Reflection.Assembly.LoadFrom(DLLFullName).GetName.Version
'        Else
'            Throw New System.IO.FileNotFoundException(String.Format("Unable to find the following requested WRDB library:\n\n{0}\n\nYou must download and install WRDB 5.0 for this program to run properly (it is available at www.wrdb.com). If you have installed the latest version of WRDB 5.0 into a non-default drive or directory, you must run the stand-alone version of WRDB at least once so it can register its location and thus allow this application to find it.", DLLFullName).Replace("\n", vbCr))
'            Return Nothing
'        End If
'    End Function

'    Public Shared Function IsWRDBInstalled(Optional ByRef ErrorMsg As String = "") As Boolean
'        If IO.Directory.Exists(DLLPath) AndAlso IO.File.Exists(DLLPath() & "\WRDBControls.dll") Then
'            ErrorMsg = ""
'            Return True
'        Else
'            ErrorMsg = String.Format("Unable to find the necessary WRDB libraries. You must download and install WRDB 5.0 for this program to run properly (it is available at www.wrdb.com). If you have installed the latest version of WRDB 5.0 into a non-default drive or directory, you must run the stand-alone version of WRDB at least once so it can register its location and thus allow this application to find it.")
'            Return False
'        End If
'    End Function

'    Public Shared Function NewDGVEditor(ByRef dg As DataGridView,
'                                        Optional ByRef _GridFont As Drawing.Font = Nothing,
'                                        Optional ByRef _ReportScaling As DGVEditor.enumReportScaling = DGVEditor.enumReportScaling.None,
'                                        Optional ByRef _printDoc As Drawing.Printing.PrintDocument = Nothing) As DGVEditor
'        Dim DGV As DGVEditor = LoadLibrary(enumLibrary.Editor)
'        If DGV IsNot Nothing Then DGV.Initialize(dg)
'        Return DGV
'    End Function

'    Public Shared Function NewDGVPrinter(ByRef dg As DataGridView, ByRef _printDoc As Drawing.Printing.PrintDocument) As DGVPrinter
'        Dim DGP As DGVPrinter = LoadLibrary(enumLibrary.Printer)
'        If DGP IsNot Nothing Then DGP.Initialize(dg, _printDoc)
'        Return DGP
'    End Function

'    Public Shared Function NewReport(ByRef _printDoc As Drawing.Printing.PrintDocument) As clsReport
'        Dim rpt As clsReport = LoadLibrary(enumLibrary.Report)
'        If rpt IsNot Nothing Then rpt.Initialize(_printDoc)
'        Return rpt
'    End Function

'    Public Shared Function NewProject(ProjectName As String) As clsProject
'        Dim Project As clsProject = LoadLibrary(enumLibrary.Project)
'        If Project IsNot Nothing Then Project.Initialize(ProjectName)
'        Return Project
'    End Function

'    Public Shared Function NewTempProject(ProjectName As String) As clsProject
'        Dim Project As clsProject = LoadLibrary(enumLibrary.Project)
'        If Project IsNot Nothing Then Project.Initialize(ProjectName, True)
'        Return Project
'    End Function

'    Public Shared Function NewWRDBIniFile() As clsWRDBIniFile
'        Return LoadLibrary(enumLibrary.IniFile)
'    End Function

'    'Public Shared Function NewTable(BaseFileName As String, ExpertMode As Boolean) As clsTable
'    '    Dim Table As clsTable = LoadLibrary(enumLibrary.Table)
'    '    If Table IsNot Nothing Then Table.Initialize(BaseFileName, ExpertMode)
'    '    Return Table
'    'End Function

'    Public Shared Function NewDataSourceBMD(FileName As String, InRam As Boolean) As clsBMD
'        Dim DataSource As clsBMD = LoadLibrary(enumLibrary.DataSource = enumLibrary.BMD)
'        If DataSource IsNot Nothing Then DataSource.Initialize(FileName, InRam)
'        Return DataSource
'    End Function

'    Public Shared Function NewExcel() As clsExcel
'        Return LoadLibrary(enumLibrary.Excel)
'    End Function

'End Class